package com.eliza.demo.vm

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import com.eliza.library.dao.QQUserRepository
import com.eliza.library.model.QQUser


/*-*- coding:utf-8 -*-
 * @Author  : debi
 * @Time    : 5/1/22
 * @Software: Android Studio
 */

/*
* 保存数据库信息
* */
class QQUserVm : AndroidViewModel {
    private var repository: QQUserRepository

    constructor(application: Application) : super(application) {
        this.repository = QQUserRepository(application);
    }

    suspend fun insertQQUser(vararg qqUser: QQUser) {
        repository.insertQQUser(*qqUser)
    }

    suspend fun deleteQQUser(vararg qqUser: QQUser) {
        repository.deleteQQUser(*qqUser)
    }


    suspend fun updateQQUser(vararg qqUser: QQUser) {
        repository.updateQQUser(*qqUser)
    }

    fun getAllQQUsersLive(): LiveData<List<QQUser>> {
        return repository.getAllQQUserList
    }
}